package homework3;

import sun.nio.cs.ext.GBK;

import java.io.*;
import java.nio.charset.StandardCharsets;

public class Test4 {
    public static void main(String[] args) {
        try (
            FileInputStream fis = new FileInputStream("./note.txt");
            InputStreamReader isr = new InputStreamReader(fis, "GBK");
            BufferedReader br = new BufferedReader(isr);

            FileOutputStream fos = new FileOutputStream("note_utf.txt");
            OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8);
            BufferedWriter bw = new BufferedWriter(osw);
            PrintWriter pw = new PrintWriter(bw);
        ){
            String line;
            while ((line = br.readLine())!=null) {
                pw.println(line);
            }
            System.out.println("转码完成！");
        }catch (IOException e) {
//            e.printStackTrace();
        }

    }
}
